package socket;

import java.io.*;
import java.net.*;

public class Penerima {
	private Socket socket;
	private BufferedReader reader;
	public Penerima(Integer port){
		try {
			ServerSocket serv = new ServerSocket();
			System.out.println("Menunggu koneksi di port " + port);
			socket = serv.accept();
			System.out.println("Ada client dari "+socket.getInetAddress().getHostAddress());
			reader = new BufferedReader(new InputStreamReader(socket.getInputStream()));
			String data;
			while((data = reader.readLine()) != null){
				System.out.println(data);
				if("exit".equalsIgnoreCase(data.trim())){
					break;
				}
			}
			stop();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	
	public 
}
